package com.xiaof.store.controller;

import com.xiaof.store.entity.Order;
import com.xiaof.store.service.IOrderService;
import com.xiaof.store.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * Created with IntelliJ IDEA.
 *
 * @ProjectName: store
 * @Package: com.xiaof.store.controller
 * @ClassName: OrderController
 * @Author: xiaof
 * @Description:
 * @Date: 2022/1/23 19:37
 * @Version: 1.0
 */
@RestController
@RequestMapping("orders")
public class OrderController extends BaseController{

    @Autowired
    private IOrderService orderService;
    @RequestMapping("/create")
    public JsonResult<Order> create(Integer aid, Integer[] cids, HttpSession session){
        Order data = orderService.create(aid, cids, getUidFromSession(session), getUsernameFromSession(session));
        return new JsonResult<>(OK,data);
    }
}
